package acme.client;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class Keys {
	
	private static Map<API, List<String>> keyMap = new HashMap<API, List<String>>();
	private static Random random = new Random();
	
	static{
		List<String> catalogKeys = new ArrayList<String>();
		catalogKeys.add("eba9nvm45yz4quawutd3s8g3");
		catalogKeys.add("jrhmbnsv8ckjfzds6afcjw9x");
		catalogKeys.add("y237smdx5tpghssvsv6qv5td");
		catalogKeys.add("6y8vjhw25522yfss4td87z4q");
		catalogKeys.add("sn9yjd6arjk543hqu64k4v2b");
		catalogKeys.add("ucx87ckvty5hbgkxzepmkgx3");
		catalogKeys.add("ygze5gkmmfaraxdgrb33j7xj");
		catalogKeys.add("ju6gg5d6qkwhg97jnmv99wsv");
		catalogKeys.add("cavkjqdkd9r9yekby3c2ch2d");
		keyMap.put(API.CatalogAPI, catalogKeys);

		List<String> dealKeys = new ArrayList<String>();
		dealKeys.add("662ez8ps55gpk6pph7qudp5x");
		dealKeys.add("jrhmbnsv8ckjfzds6afcjw9x");
		dealKeys.add("y237smdx5tpghssvsv6qv5td");
		dealKeys.add("6y8vjhw25522yfss4td87z4q");
		dealKeys.add("sn9yjd6arjk543hqu64k4v2b");
		dealKeys.add("ucx87ckvty5hbgkxzepmkgx3");
		dealKeys.add("ygze5gkmmfaraxdgrb33j7xj");
		dealKeys.add("ju6gg5d6qkwhg97jnmv99wsv");
		dealKeys.add("cavkjqdkd9r9yekby3c2ch2d");
		keyMap.put(API.DailyDealAPI, dealKeys);
	}
	
	public static List<String> getKeys(API api){
		return keyMap.get(api);
	}
	
	public static String getRandomKey(API api){
		double val = random.nextDouble();
		double rawIndex = val * (getKeys(api).size() - 1);
		int index = Math.round(new Float(rawIndex));
		return getKeys(api).get(index);
	}

}
